package Script;

import java.util.Arrays;

/**
 * Used to wrap byte arrays, since it is not
 * adviced to store them directly as entries
 * in hash tables.
 * 
 * @author Tobias
 */
public final class TableValueWrapper {
	private final byte[] b;

    public TableValueWrapper(byte[] data)
    {
        if (data == null)
        {
            throw new NullPointerException();
        }
        this.b = data;
    }

    @Override
    public boolean equals(Object other)
    {
        if (!(other instanceof TableValueWrapper))
        {
            return false;
        }
        return Arrays.equals(b, ((TableValueWrapper)other).b);
    }

    @Override
    public int hashCode()
    {
        return Arrays.hashCode(b);
    }
    
    public byte[] getData() {
    	return b;
    }
}
